Day 80 (Week12), 2021/06/30 (Wednesday)

學習時數:7 hr

Done

  • [BE101] API 實作 & jQuery
  • 留言板:實作 API(api_comments & api_add_comments)
  • 5th 實體聚會分享 後端工程師成長之路
  • Bootstrap

To Do @ this week

  • hw1 留言板
  • hw2 to do list

學習心得紀錄

Objective 客觀

API 實作

瞭解 array()array_push(<arrayName>, array()); 的差別,怎麼樣利用陣列 array() 將資料放進去,然後轉換成 json 的格式,一開始很多大括號,還有 PHP 的 array 表示法,看了很不習慣,所以就嘗試轉成了平常 json 的長相:

//PHP
Array ( [comments] => Array ( [0] => Array ( [id] => 1 [username] => aaa [content] => 123 ) [1] => Array ( [id] => 2 [username] => bbb [content] => 456 ) ) )

//白話文
[ comments: 
  [ 
    [id: 1, username: 'aaa', content: '123']
    [id: 2, username: 'bbb', content: '456']
  ]
]

// 使用 encode 轉成 JSON 格式
{
  "comments":
    [
        {"id":1,"username":"aaa","content":"123"},
        {"id":2,"username":"bbb","content":"456"}
     ]
}

POSTMAN 真的是測試 API 很方便的工具,可以輸入資料到資料庫,也可以看 API 有沒有執行成功。不過在找怎麼打開 postman 裡的 request 視窗在哪裡花了一點時間。
jQuery 使用之前要先 $(document).ready(function() {}) 才能使用 jQuery 的指令,其特色就是大部分都是 $(),然後加 .css 之類的簡潔語法,與原生的 JavaScript 相比簡潔很多。

感受

聽了 Wayne 大大的分享,讓我想起了國中作文老師的風格,蘊含了一點哲學的感覺,講了很多平常我應該思考,但是都沒有思考的內容,像是認識自己、對於未來、工程師的想像,或者是能不能接受一天八小時在 code 等等的問題,後來也聽了大大推薦的 youtube 頂樓加蓋 ep.2 和 ep.3。

Decisional 決定行動

簡單瞭解了 jQuery 的語法,明天要來做留言板了!

#jquery #分享 #PHP







你可能感興趣的文章

Command Line 基本指令

Command Line 基本指令

如何使用 Heroku 部屬一個 Web App 網頁應用程式

如何使用 Heroku 部屬一個 Web App 網頁應用程式

Selenium with JS and infinite scroll

Selenium with JS and infinite scroll






留言討論